package com.xsl.culture.mybasevideoview.view.secondui;

import android.os.CountDownTimer;
import android.text.TextUtils;

import com.xsl.culture.R;
import com.xsl.culture.mybasevideoview.base.BaseActivity;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;


/** 
 * description: 启动页
 * author: Allen
 * date:
 */
public class SplashActivity extends BaseActivity {


    public static int flag = 1;
    @Override
    protected int layoutId() {
        return R.layout.activity_app_splash_layout;
    }

    @Override
    protected void bindData() {
        flag = 2;
        EventBus.getDefault().register(this);
        CountDownTimer mDownTimer = new CountDownTimer(1000, 1000) {
            @Override
            public void onTick(long l) {
            }

            @Override
            public void onFinish() {
                toActivity(DesActivity.class);
//                toActivity(DescriptionActivity.class);
            }
        };
        mDownTimer.start();
    }

    //关闭界面
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageEvent(String flag) {
        if(TextUtils.equals("finish",flag)){
            finish();
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
        flag = 1;
    }

}
